package com.wanxi.service.impl;

import com.wanxi.dao.CuisineDao;
import com.wanxi.dao.impl.CuisineDaoImpl;
import com.wanxi.dto.CuisineDTO;
import com.wanxi.model.CuisineModel;
import com.wanxi.service.CuisineService;
import com.wanxi.util.Tool;
import com.wanxi.vo.CuisineVO;

import java.util.List;

public class CuisineServiceImpl implements CuisineService {
    private CuisineDao cuisineDao = new CuisineDaoImpl();

    @Override
    public List<CuisineDTO> findAll(CuisineVO cuisineVO) {
//        1.将vo数据复制到model
        CuisineModel cuisineModel = Tool.copy(cuisineVO, CuisineModel.class);
//        2.得到dao层查询数据
        List<CuisineModel> cuisineModelList = cuisineDao.findAll(cuisineModel);
//        3.将得到的数据复制到dto传递给servlet
        return Tool.copy(cuisineModelList, CuisineDTO.class);
    }
}
